<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/inc/taglib.jsp"%>
<div class="pageHeader">
	<form id="pagerForm" onsubmit="return navTabSearch(this);" action="${pageContext.request.contextPath}/shop/shop/shoplist" method="post">
		<!-- 分页表单参数 -->
		<%@include file="/WEB-INF/page/inc/pageForm.jsp"%>
		<!-- 需要排序的字段 -->
		<input type="hidden" name="orderField" value="${requestScope.dwzPageBean.countResultMap.orderField}" />
		<!-- 正序倒序 -->
		<input type="hidden" name="orderDirection" value="${requestScope.dwzPageBean.countResultMap.orderDirection}" />
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<%-- <td>客户名称：<input type="text" name="shopName" value="${requestScope.dwzPageBean.countResultMap.shopName}" size="20" placeholder="请输入客户名称" /></td> --%>
					<td>客户名称： <input size="20" placeholder="请输入客户名称" name="org2.shopName" type="text" postField="shopName" suggestFields="shopName" suggestUrl="${pageContext.request.contextPath}/shop/shop/getshoplistshopName" lookupGroup="org2" value="${requestScope.dwzPageBean.countResultMap.shopName}" /></td>
					<td>上一次跟进时间：<input name="startTime" class="date textInput readonly" readonly="true" type="text" size="20" value="${requestScope.dwzPageBean.countResultMap.startTime}" placeholder="请输入上一次跟进时间" style="margin-right: 5px;">至 <input style="margin-left: 5px;" name="endTime" class="date textInput readonly" readonly="true" mindate="" type="text" value="${requestScope.dwzPageBean.countResultMap.endTime}" placeholder="请输入上一次跟进时间"></td>
					<td style="width: 425px;" colspan="2"><label class="nowrap" style="width: 30px;">地址：</label> <input type="hidden" name="areaName" class="required" value="${requestScope.record.areaName}" /> <select class="combox required" name="areaCode" id="shop_combox_province" ref="shop_combox_city" refUrl="${pageContext.request.contextPath}/system/areas/getCityByProvince?id={value}&isSearch=true" default-value="110000">
							<option value="">请选择</option>
							<c:forEach items="${requestScope.provinces}" var="item">
								<option value="${item.id}" ${item.id==requestScope.dwzPageBean.countResultMap.province?"selected":""}>${item.name}</option>
							</c:forEach>
					</select> <select class="combox required" name="areaCode" id="shop_combox_city" ref="shop_combox_region" refUrl="${pageContext.request.contextPath}/system/areas/getCountyByAreas?id={value}&isSearch=true" default-value="110100">
							<option value="">请选择</option>
							<c:forEach items="${requestScope.citys}" var="item">
								<option value="${item.id}" ${item.id==requestScope.dwzPageBean.countResultMap.city?"selected":""}>${item.name}</option>
							</c:forEach>
					</select> <select class="combox required" name="areaCode" id="shop_combox_region" default-value="110100">
							<option value="">请选择</option>
							<c:forEach items="${requestScope.countys}" var="item">
								<option value="${item.id}" ${item.id==requestScope.dwzPageBean.countResultMap.county?"selected":""}>${item.name}</option>
							</c:forEach>
					</select></td>
				</tr>
			</table>
			<div class="subBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">查询</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<%-- <li><a class="add" href="${pageContext.request.contextPath}/shop/shopList/toInsert" rel="insert" target="dialog" mask="true"><span>新增店铺</span></a></li>
			<li><a class="delete" href="${pageContext.request.contextPath}/shop/shopList/delete" rel="id" target="selectedTodo" title="确定要删除吗？" warn="请最小选择一条记录" mask="true"><span>批量删除</span></a></li> --%>
			<shiro:hasPermission name="/shop/shop/shopListexport">
				<li><a href="${pageContext.request.contextPath}/shop/shop/shopListexport" target="dwzExport" targetType="navTab" title="是要导出这些记录吗?" class="icon"><span>导出EXCEL</span></a></li>
			</shiro:hasPermission>
		</ul>
	</div>
	<table class="table" targetType="navTab" asc="asc" desc="desc" width="100%" layoutH="138">
		<thead>
			<tr>
				<th orderField="shop_name" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'shop_name'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>客户名称</th>
				<th orderField="area_name" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'area_name'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>所在区域</th>
				<th orderField="fwtm" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'fwtm'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>上一次跟进时间</th>
				<th orderField="updatetime" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'updatetime'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>上一次送货时间</th>
				<th orderField="state" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'state'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>门店状态</th>
				<th width="180">操作</th>
			</tr>
		</thead>
		<tbody>
			<c:if test="${requestScope.dwzPageBean != null &&  requestScope.dwzPageBean.recordList != null }">
				<c:forEach var="record" items="${requestScope.dwzPageBean.recordList}" varStatus="status">
					<tr ondblclick="openDetails(this)" target="navTab" href="${pageContext.request.contextPath}/shop/shop/ShopOrderList?shopId=${record.shopId}" title="客户详情">
						<td>${record.shopName}</td>
						<td>${record.areaName}</td>
						<%-- <td>${record.sffwtm}</td> --%>
						<td><fmt:formatDate pattern="yyyy-MM-dd" value="${record.fwtm}" /></td>
						<td><fmt:formatDate pattern="yyyy-MM-dd" value="${record.updatetime}" /></td>
						<td>${record.state == 1 ? '新客户':''}${record.state == 2 ? '门店建设中':''}${record.state == 3 ? '门店配货中':''}${record.state == 4 ? '常规客户':''}</td>
						<td><shiro:hasPermission name="/shop/shop/ShopOrderList">
								<a title="客户详情" mask="true" target="navTab" rel="${pageContext.request.contextPath}/shop/shop/shoplist" href="${pageContext.request.contextPath}/shop/shop/ShopOrderList?shopId=${record.shopId}" class="detailsBtn"><span style="margin-right: 10px">客户详情</span></a>
							</shiro:hasPermission> 
							
							<shiro:hasPermission name="/shop/shop/ProductInventoryList">
								<a title="库存详情" mask="true" target="dialog" href="${pageContext.request.contextPath}/shop/shop/ProductInventoryList?shopId=${record.shopId}" class="detailsBtn" width="820" height="460"><span>库存详情</span></a>
							</shiro:hasPermission></td>
					</tr>
				</c:forEach>
			</c:if>
		</tbody>
	</table>
	<!-- 分页条 -->
	<%@include file="/WEB-INF/page/inc/pageBar.jsp"%>
</div>